#pragma once

#include "connection_pool.hpp"
#include <hiredis/hiredis.h>

struct RedisConfig {
    std::string host = "localhost";
    int port = 6379;
    std::string password = "";
    int database = 0;
    ConnectionPoolConfig pool_config;
};

class RedisPool : public ConnectionPool<redisContext> {
public:
    explicit RedisPool(const RedisConfig& config);
    ~RedisPool() override = default;
protected:
    std::shared_ptr<redisContext> create_connection() override;
    bool validate_connection(redisContext* conn) override;
    void close_connection(redisContext* conn) override;

private:
    RedisConfig config_;
};